import React, { useState } from "react";

export default function UserAdd({listAdd}) {
  const [info, setinfo] = useState({ username: "", userage: "" });

  return (
    <div>
      <div>
        用户名{" "}
        <input
          value={info.username}
          onChange={(e) => {
            setinfo({ ...info, username: e.target.value });
          }}
        />{" "}
      </div>
      <div>
        年龄{" "}
        <input
          value={info.userage}
          onChange={(e) => {
            setinfo({ ...info, userage: e.target.value });
          }}
        />{" "}
      </div>
      <button onClick={()=>{
            listAdd(info);
      }}>新增</button>
    </div>
  );
}
